let utils = data["utils"];
let STUtil = data["STUtil"];
let Node = data["Node"];
let SplayTree = data["SplayTree"];
let isInBbox = data["isInBbox"];
let getBboxOverlap = data["getBboxOverlap"];
let cmp = data["cmp"];
let crossProduct = data["crossProduct"];
let dotProduct = data["dotProduct"];
let compareVectorAngles = data["compareVectorAngles"];
let sineOfAngle = data["sineOfAngle"];
let cosineOfAngle = data["cosineOfAngle"];
let closestPoint = data["closestPoint"];
let horizontalIntersection = data["horizontalIntersection"];
let verticalIntersection = data["verticalIntersection"];
let intersection = data["intersection"];
let perpendicular = data["perpendicular"];
let rounder = data["rounder"];
let geomIn = data["geomIn"];

let geomOut = data["geomOut"];
let RingOut = geomOut["RingOut"];
let Segment = data["Segment"];
let SweepEvent = data["SweepEvent"];

console.log("10PolygonClipping_geom-out02");


utils.extend(RingOut.prototype, {
  getGeom: function () {
    let prevPt = this.events[0].point;
    const points = [prevPt];
    for (let i = 1, iMax = this.events.length - 1; i < iMax; i++) {
      const pt = this.events[i].point,
        nextPt = this.events[i + 1].point;
      0 !== compareVectorAngles(pt, prevPt, nextPt) && (points.push(pt), prevPt = pt)
    }
    if (1 === points.length) return null;
    const pt = points[0],
      nextPt = points[1];
    0 === compareVectorAngles(pt, prevPt, nextPt) && points.shift(), points.push(points[0]);
    const step = this.isExteriorRing() ? 1 : -1,
      iStart = this.isExteriorRing() ? 0 : points.length - 1,
      iEnd = this.isExteriorRing() ? points.length : -1,
      orderedPoints = [];
    for (let i = iStart; i != iEnd; i += step) orderedPoints.push([points[i].x, points[i].y]);
    return orderedPoints
  },
  isExteriorRing: function () {
    if (void 0 === this._isExteriorRing) {
      const enclosing = this.enclosingRing();
      this._isExteriorRing = !enclosing || !enclosing.isExteriorRing()
    }
    return this._isExteriorRing
  },
  enclosingRing: function () {
    return void 0 === this._enclosingRing && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing
  },
  _calcEnclosingRing: function () {
    let leftMostEvt = this.events[0];
    for (let i = 1, iMax = this.events.length; i < iMax; i++) {
      const evt = this.events[i];
      SweepEvent.compare(leftMostEvt, evt) > 0 && (leftMostEvt = evt)
    }
    let prevSeg = leftMostEvt.segment.prevInResult(),
      prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
    for (; ;) {
      if (!prevSeg) return null;
      if (!prevPrevSeg) return prevSeg.ringOut;
      if (prevPrevSeg.ringOut !== prevSeg.ringOut) return prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut ? prevSeg.ringOut : prevSeg.ringOut.enclosingRing();
      prevSeg = prevPrevSeg.prevInResult(), prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null
    }
  }
});



return {
  "utils": utils,
  "STUtil": STUtil,
  "Node": Node,
  "SplayTree": SplayTree,
  "isInBbox": isInBbox,
  "getBboxOverlap": getBboxOverlap,
  "cmp": cmp,
  "crossProduct": crossProduct,
  "dotProduct": dotProduct,
  "compareVectorAngles": compareVectorAngles,
  // "length":length,
  "sineOfAngle": sineOfAngle,
  "cosineOfAngle": cosineOfAngle,
  "closestPoint": closestPoint,
  "horizontalIntersection": horizontalIntersection,
  "verticalIntersection": verticalIntersection,
  "intersection": intersection,
  "perpendicular": perpendicular,
  "rounder": rounder,
  "geomIn": geomIn,
  "geomOut": geomOut,
  "Segment": Segment,
  "SweepEvent": SweepEvent
}